home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 3.1 KB | 90 lines |
- ' ************************************* Commands used:
- ' * * =Count Pixels Splinters Max
- ' * Amcaf Examples * Coords Bank Splinters Fuel
- ' * Splinters V1.1 * Coords Read Splinters Init
- ' * Written by Chris Hodges * Splinters Bank Splinters Double Do
- ' * * Splinters Colour =Splinters Active
- ' ************************************* Splinters Limit
- '
- ' First load some GFX to destroy :)
- Load Iff "Data/AMCAFSmall.iff",0
- Curs Off : Paper 0 : Pen 1
- Double Buffer
- Autoback 1
- ' Limit mouse to full screen. Wait Vbl ensures that Limit Mouse works
- ' correctly.
- Wait Vbl
- Limit Mouse
- ' Set writing mode to xor for rubber banding.
- Gr Writing 2
- Repeat
- ' Get the rectanguar area to be exploded.
- Gosub FETCHCOORDS
- ' Now count how many pixels are in this area.
- NUMPIX= Extension_8_0CF2(0,0,X1,Y1 To X2,Y2)
- ' Check if there are any, and then let them explode.
- If NUMPIX
- ' Reserve a bank to hold the coords.
- Extension_8_0D10 9,NUMPIX
- ' Read them in.
- Extension_8_0D2E 0,0,X1,Y1 To X2,Y2,9,1
- ' Now reserve a bank for the splinters.
- Extension_8_0D4E 10,NUMPIX
- ' Limit the splinters to the full screen.
- Extension_8_0D66
- ' Set the colour which will be left and the number of bitplanes.
- Extension_8_0DB8 0,4
- ' Adjust the gravity.
- Extension_8_0D8A 1,4
- ' Set the maximum of pixel which can explode per frame or -1 for all.
- Extension_8_0E62 -1
- ' Set the number of frames the splinters fly, or -1 for screen
- ' limits only.
- Extension_8_0F2A -1
- ' Initialise the splinters bank.
- Extension_8_0DA4
- ' Main loop...
- Repeat
- Screen Swap : Wait Vbl
- ' Splinters Double Do does following steps.
- ' 1. Splinters Double Del: Removes all old splinters and restores the
- ' background.
- ' 2. Splinters Move : Moves the splinters one single step.
- ' 3. Splinters Back : Saves the background pixels.
- ' 4. Splinters Draw : Plots every dot to the screen.
- Extension_8_0DEC
- Until Extension_8_0F40 =0
- End If
- Until Inkey$<>""
- Screen Close 0
- End
- FETCHCOORDS:
- ' Now ask for the upper left edge coordinates
- Home : Print "Click mouse at the upper left corner."
- ' Wait for click
- Repeat : Multi Wait : Until Mouse Key
- ' Get coords x1,y1
- X1=X Screen(X Mouse)
- Y1=Y Screen(Y Mouse)
- ' Clear line and wait for release.
- Home : Cline
- Print "Click mouse at the lower right corner."
- While Mouse Key : Multi Wait : Wend
- ' Draw rubber band until mouse is pressed.
- Repeat
- X2=X Screen(X Mouse)
- Y2=Y Screen(Y Mouse)
- Box X1,Y1 To X2,Y2
- Multi Wait
- Box X1,Y1 To X2,Y2
- Until Mouse Key
- ' Clear line and wait until mouse button released.
- Home : Cline
- While Mouse Key : Multi Wait : Wend
- ' Check if coors must be swapped.
- If X2<X1 Then Swap X1,X2
- If Y2<Y1 Then Swap Y1,Y2
- ' As the coordsbase is 1,1, add one pixel to each coordinate.
- Add X2,1
- Add Y2,1
- Return